<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<link rel="stylesheet" href="../css/ui-box.css">
    <link rel="stylesheet" href="../css/ui-base.css">
    <link rel="stylesheet" href="../css/ui-color.css">
    <link rel="stylesheet" href="../css/base.css">
    <link rel="stylesheet" href="../css/img.css">

	<script src="../js/core/zy_control.js"></script>
    <script src="../js/core/zy_click.js"></script>
    <script src="../js/core/appframework.js"></script>
    <script src="../js/main.js"></script>
    <script src="../js/core.js"></script>
    <script src="../js/res.js"></script>
    
    <script src="../js/signup.js"></script>

</head>
<body class="ub ub-ver ub-img3">
    <div id="header" class="ub t-bla">
        <div id="leftBtn" class="uw2 ub ub-ac" ontouchstart="zy_touch()" onclick="WinClose();">
            <div class="uw1p5 uh1p5 ub-img1 im_icon_reg_back uml_1"></div>
        </div>
        <div id="title" class="up_title ub-f1 ut-s tx-c c_gra1">注册用户</div>
        <div id="rightBtn" class="uw4 ub_center">
            <div class="uw2 ub ub-ac ub-pc uh1p5 ub_img im_undefined"></div>
        </div>
    </div>
    <div class="upper08 ub-f1">
        <div class="up1 t-bla">
             <div class="uplr_p5 uc-a1">
                <div class="ub ub-ac">
                    <div class="uw1p5 uh1p5 ub-img im_icon_username uml_p5 umr_1"></div>
                    <input id="name" placeholder="昵称/Nickname" type="text"  class="input t-bla ub ub-f1">   
                </div>
                <div class="b_list signup_input_ctn"></div>
            </div>
            <div class="uplr_p5 uc-a1 umt_1">
                <div class="ub ub-ac">
                     <div class="uw1p5 uh1p5 ub-img im_icon_phone uml_p5 umr_1"></div>
                     <input id="phone" placeholder="手机号/Mobile No" type="number"  class="input t-bla ub ub-f1">   
                     <div class="ub ub-ac ub-pe umr_2f">
                            <div id="code" data-code="0" ontouchstart="zy_touch()" onclick="Signup.sendCode();" class="btn bc_btn uw8 uh3 t-wh ufp7 umr_1f umb_1" style="padding:0.3em 0.7em;">验证码<br/>Verification Code</div>
                     </div> 
                </div>
                <div class="b_list signup_input_ctn"></div>
            </div>
            <div class="uplr_p5 uc-a1 umt_1">
                <div class="ub ub-ac">
                     <div class="uw1p5 uh1p5 ub-img im_icon_phone uml_p5 umr_1"></div>
                     <input id="codeNum" placeholder="验证码/Verification Code" type="number"  class="input t-bla ub ub-f1">   
                     <div class="uml_3f"></div>
                </div>
                <div class="b_list signup_input_ctn"></div>
            </div>
            <div class="uplr_p5 uc-a1 umt_1">
                <div class="ub ub-ac">
                     <div class="uw1p5 uh1p5 ub-img im_icon_password uml_p5 umr_1"></div>
                     <input id="password" placeholder="密码/Password" type="password"  class="input t-bla ub ub-f1"> 
                </div>
                <div class="b_list signup_input_ctn"></div>
            </div>
            <div class="uc-a1 umt_1 ub">
                <div class="ub-f1 ub ub-ac ub-pc">
                    <div class="uw5 uh4 ub_img im_icon_yun-china"></div>
                     <div id="checkChina" class="uw1p5 uh1p5 ub_img im_checkbox" ontouchstart="zy_touch()" onclick="checkbox()"></div>
                </div>  
                <div class="ub-f1 ub ub-ac ub-pc">
                    <div class="uw5 uh4 ub_img umr_3 im_icon_yun-expat"></div>
                      <div id="checkExpat" class="uw1p5 uh1p5 ub_img im_checkbox uml_1" ontouchstart="zy_touch()" onclick="checkbox()"></div>
                </div>    
            </div>
            <div class="umt_1 ufp8 c_gra1 uw109 uml_1f">提示：昵称、手机号、验证码、密码是必填项</div>
            <div class="umt_1 ufp8 c_gra1 uml_3f uw133">Notice：Nickname,Mobile No,Verification Code,Password are necessary</div>
        </div> 
        <div id="regBtn" ontouchstart="zy_touch()" onclick="reg();" class="btn bc_btn t-bla umt_2">注　册/Register</div>   
    </div>
</body>
</html>
<script>
zy_init();
function checkbox() {
    var dom = event.currentTarget;
    if (!$(dom).hasClass("im_checkbox_selected")){
        $(".im_checkbox").removeClass("im_checkbox_selected");
        $(dom).addClass("im_checkbox_selected");
    }
}
function reg(){
    if (!Core.check())
        return;
    if (!checkMobile($("#phone").val()))
        return;
    if(!IsDefine($("#codeNum").val())){
        return $alert("验证码不能为空!");   
    }
    var yzm = GetLS("yanzhengma");
    if(yzm.num != $("#codeNum").val()){
        $alert("验证码有误!");
        return;
    }
    if(yzm.phone != $("#phone").val() ){
        $alert("请使用正确的手机号!");
        return;
    }
    var data = new Object();
    $("body").find("input").each(function(){
        data[$(this).attr("id")] = $(this).val();
    });
    if(!$("#checkChina").hasClass("im_checkbox_selected")&&!$("#checkExpat").hasClass("im_checkbox_selected")){
       $alertCE(" 请选 择 ”我 是 中 国 人” or “I am expat” !<br>Please select “I am expat” or “我是中国人”!")
       return;
    }
    if($(".im_checkbox_selected").prev().hasClass("im_icon_yun-expat"))
        data.category = Role.TYPE_FOREIGNER;
    else
        data.category = Role.TYPE_CHINESE;
        
    if(data.category == 30){
        $confirm("如果你选择的是“我是中国人”，进入的“老外圈”将是中文界面",function(){
             $ajax({
                url:"/user/reg", 
                data:data, 
                success:function(res){
                    if(res.code)
                        return $alert(res.codemsg);
                    
                    SetLS("user", res.result);
                    WinClose();
                }
            });           
        });
    }else{
        $confirmEn("If you select” I am expat”, you will use English version of “Expats Circle”",function(){
             $ajax({
                url:"/user/reg", 
                data:data, 
                success:function(res){
                    if(res.code)
                        return $alert(res.codemsg);
                    
                    SetLS("user", res.result);
                    WinClose();
                }
            });           
        });
    }
}
window.uexOnload = function(type){
    if (!type) {
        Add20ToHeader();
        
    }
}
</script>